package com.woshua.stretchlistview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ImageView;

import com.woshua.stretchlistview.view.StretchListView;

public class MainActivity extends AppCompatActivity {

    private StretchListView listView;
    private ImageView iv;
    private ImageView iv_icon;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        View header= View.inflate(this,R.layout.header_view,null);
        listView=findViewById(R.id.listView);
        iv=header.findViewById(R.id.iv_header);
        iv_icon=header.findViewById(R.id.iv_icon);

        ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1,
                new String[]{
                        "星期一",
                        "星期二",
                        "星期三",
                        "星期四",
                        "星期五",
                        "星期一",
                        "星期二",
                        "星期三",
                        "星期四",
                        "星期五",
                        "星期一",
                        "星期二",
                        "星期三",
                        "星期四",
                        "星期五",
                }
        );

        listView.addHeaderView(header);
        listView.setZoomImageView(iv);
        listView.setHeaderImageView(iv_icon);
        listView.setAdapter(adapter);
    }
}
